import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:cleanetc_client/core/http/http.dart';
import 'package:cleanetc_client/core/utils/locale.dart';
import 'package:cleanetc_client/core/utils/toast.dart';
import 'package:cleanetc_client/generated/l10n.dart';
import 'package:cleanetc_client/router/route_map.dart';
import 'package:get/get.dart';

import 'package:get/get.dart';
import 'package:provider/provider.dart';

import 'splash.dart';

//默认App的启动
class DefaultApp {
  //运行app
  static void run() {
    WidgetsFlutterBinding.ensureInitialized();
    initFirst().then((value) => runApp(ToastUtils.init(MyApp())));
    initApp();
  }

  /// 必须要优先初始化的内容
  static Future<void> initFirst() async {
    await LocaleUtils.init();
  }

  /// 程序初始化操作
  static void initApp() {
    XHttp.init();
  }
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Project',
      home: SplashPage(),
    );
  }
}
